//登录注册模块的路由
const express = require('express')

//express框架路由引入
const router = express.Router()

//导入login的路由处理模块
const loginHandler = require('../router_handle/login')

//导入exprejoi
const expressJoi = require('@escook/express-joi')
//导入验证规则
const { login_limit } = require('../limit/login')

//导入密码重置相关验证规则和处理函数
const { sendCodeLimit, verifyCodeLimit, resetPasswordLimit } = require('../limit/login');
const { sendVerificationCode, verifyCode, resetPassword } = require('../router_handle/login');

// 发送验证码
router.post('/send-code', expressJoi(sendCodeLimit), sendVerificationCode);
// 验证验证码
router.post('/verify-code', expressJoi(verifyCodeLimit), verifyCode);
// 重置密码
router.post('/reset-password', expressJoi(resetPasswordLimit), resetPassword);
//注册
router.post('/register', expressJoi(login_limit), loginHandler.register)
//登录
router.post('/login', expressJoi(login_limit), loginHandler.login)

module.exports = router